home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 18 / fpc103.zip / BOXTEXT.SEQ < prev    next >
Text File  |  1988-04-22  |  2KB  |  61 lines

  1. \ BOXTEXT.SEQ   Some simple boxes around text.          by Tom Zimmer
  2.  
  3. comment:
  4.  
  5.         BOXTEXT.SEQ
  6.  
  7.           A cute little routine that works like ." to print messages
  8.         to the screen.  The difference here is that .BOX" requires an
  9.         X and Y coordinate of where to start printing the message,
  10.         and it also prints a box around your text string, with
  11.         graphic line draw characters.  .BOX" is used as follows:
  12.  
  13.                 : boxtest       ( --- )
  14.                                 10 10 .box" hello there"
  15.                                 15 20 .box" This is a box test" ;
  16.  
  17.           As you can see it is used like ." .
  18.  
  19. comment;
  20.  
  21. 0 constant tx   0 constant ty
  22. 0 constant bx   0 constant by
  23.  
  24. : box           ( left top right bottom --- )
  25.                 =: by =: bx =: ty =: tx
  26.                 tx ty at
  27.                 218 FEMIT
  28.                 bx tx - 1- 0 max 0
  29.                ?do      196 FEMIT
  30.                 loop    191 FEMIT
  31.                 tx by at
  32.                 192 FEMIT
  33.                 bx tx - 1- 0 max 0
  34.                ?do      196 FEMIT
  35.                 loop    217 FEMIT
  36.                 by ty 1+
  37.                ?do      tx i at 179 FEMIT
  38.                         bx i at 179 FEMIT
  39.                 loop    ;
  40.  
  41. : (.box)        ( x y --- )
  42.                 X>"BUF
  43.                 >r over r@ c@ + 3 + over 2+ box
  44.                 tx 1+ ty 1+ at bl FEMIT r> count type bl FEMIT
  45.                 bx by 1+ at ;
  46.  
  47. : .box"         ( x y text --- )
  48.                 compile (.box) X," ; immediate
  49.  
  50.  
  51. \s
  52. : boxsample     ( --- )
  53.                 20 2
  54.                 do      i 2* i .box" Ziping along!"
  55.                 loop
  56.                 10 10 .box" hello this is a sample of BOXED TEXT"
  57.                 20 15 .box" Here is even more text!!" ;
  58.  
  59. boxsample
  60.  
  61.